package com.lx.router;

import com.lx.handler.UserHandler;

import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.RouterFunctions;
import org.springframework.web.reactive.function.server.ServerResponse;

/**
 * 用户操作控制器
 * 总路由配置方式
 *
 * @author 段誉
 * @create 2019-05-15 15:24
 */
public class UserRouter {
  /**
   * 指定单个接口的路由
   * @param userHandler
   * @return org.springframework.web.reactive.function.server.RouterFunction<org.springframework.web.reactive.function.server.ServerResponse>
   * @author 段誉
   * @date 2019/5/15 15:26
   * @throws
   * @since 1.0.0
   */
  public static RouterFunction<ServerResponse> router(UserHandler userHandler) {
    return RouterFunctions.route()
            .GET("/get_all", userHandler::getAll)
            .PUT("/add", userHandler::add)
            .GET("/get_list_by_name", userHandler::getListByName)
            .GET("/get_list_page_by_name", userHandler::getListPageByName)
            .build();
  }
}
